@extends('layouts.admin')
@section('style')
    <link rel="stylesheet" type="text/css" href="{{ asset('css/account_check.css') }}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('css/alistar.css') }}" />
@endsection
@section('content')
    <div style="padding:5px;">
        <div class="admin_base">
            <div class="admin_module clearfix">
                <blockquote style="font-size:18px;color:orangered;" class="layui-elem-quote">
                    建议：让买家使用<a href="http://m3w.cn/numayanhao" target="_blank">“驽马验号”</a>APP进行截图,截图后可在此查看账号详情。（<a href="http://m3w.cn/numayanhao" target="_blank">【点这里下载APP】</a>）
                </blockquote>
                <div id="list_search" style="width:100%" class="clearfix">
                    <form action="{{ url('account/check') }}" id="VoForm" class="layui-form layui-form-pane"
                          novalidate="1">
                        <div clss="layui-inline">
                            <div class="layui-form-item">
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" name="account_no" id="account_no" value="" placeholder="输入买家账号" />
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-inline">
                                    <button class="layui-btn" lay-submit lay-filter="btn_query">检索</button>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="box_list">
                <div class="layui-tab layui-tab-brief" lay-filter="detailTab">
                    <ul class="layui-tab-title">
                        <li class="layui-this">本站补单情况</li>
                        <li>账号信息</li>
                        <li>账号截图</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show"></div>
                        <div class="layui-tab-item" id="info_tab">
                            <div id="basic_info"></div>
                        </div>
                        <div class="layui-tab-item" id="image_tab" >
                            <blockquote class="layui-elem-quote xm-quote red"  id="no_data_found">
                                请买家使用“驽马验号”APP进行截图
                            </blockquote>
                            <div class="cutimage" id="cutimage_content" style="width: 100%" ></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="admin_bottom"></div>
    </div>
    <script type="text/html" id="content">
        @{{ if(nodata==1) }}
            <blockquote class="layui-elem-quote xm-quote red">
                没有任何补单记录
            </blockquote>
        @{{ else }}
            @{{ if(doing) }}
                <blockquote class="layui-elem-quote xm-quote orangered">
                    补单中：@{{ doing }}
                </blockquote>
            @{{ /if }}
            <blockquote class="layui-elem-quote xm-quote orangered">
                最近一次补单：@{{ lasttime }}
            </blockquote>
            <blockquote class="layui-elem-quote xm-quote orangered">
                截止目前：补单总数：<span style="color:blue">@{{ nums }}</span> 笔 补单金额：<span style="color:blue">&yen;@{{ money }}</span> 佣金：<span style="color:blue">&yen;@{{ commission }}</span>
            </blockquote>
            <blockquote class="layui-elem-quote xm-quote orangered">
                补单情况汇总
            </blockquote>
            <table class="layui-table">
                <thead>
                <tr>
                    <th rowspan="2">店铺名称</th>
                    <th colspan="3">1周内</th>
                    <th colspan="3">1个月内</th>
                    <th colspan="3">3个月内</th>
                    <th colspan="3">6个月内</th>
                    <th colspan="3">6个月前</th>
                </tr>
                <tr>
                    <th>笔数</th>
                    <th>金额</th>
                    <th>佣金</th>
                    <th>笔数</th>
                    <th>金额</th>
                    <th>佣金</th>
                    <th>笔数</th>
                    <th>金额</th>
                    <th>佣金</th>
                    <th>笔数</th>
                    <th>金额</th>
                    <th>佣金</th>
                    <th>笔数</th>
                    <th>金额</th>
                    <th>佣金</th>
                </tr>
                </thead>
                <tbody>
                @{{ each datas value i  }}
                    <tr>
                        <td>@{{ value.shop_title}}</td>
                        <td>@{{ value.num_1 }}</td>
                        <td style="text-align: right">@{{ value.money_1|moneyFmt }}</td>
                        <td style="text-align: right">@{{ value.commission_1|moneyFmt }}</td>
                        <td>@{{ value.num_2 }}</td>
                        <td style="text-align: right">@{{ value.money_2|moneyFmt }}</td>
                        <td style="text-align: right">@{{ value.commission_2|moneyFmt }}</td>
                        <td>@{{ value.num_3 }}</td>
                        <td style="text-align: right">@{{ value.money_3|moneyFmt }}</td>
                        <td style="text-align: right">@{{ value.commission_3|moneyFmt }}</td>
                        <td>@{{ value.num_4 }}</td>
                        <td style="text-align: right">@{{ value.money_4 |moneyFmt}}</td>
                        <td style="text-align: right">@{{ value.commission_4 |moneyFmt}}</td>
                        <td>@{{ value.num_5 }}</td>
                        <td style="text-align: right">@{{ value.money_5|moneyFmt }}</td>
                        <td style="text-align: right">@{{ value.commission_5|moneyFmt }}</td>
                    </tr>
                @{{ /each }}
                </tbody>
            </table>
        @{{ /if }}
    </script>
    <script type="text/html" id="cutimage">
        @{{ if(hasInfo) }}
            @{{ each images value i  }}
                <div class="item">
                    <img src="@{{ value.image }}" />
                    <div>@{{ value.name }}</div>
                </div>
            @{{ /each }}
        @{{ /if }}
    </script>
    <script type="text/html" id="account_info">
        @{{ if(!hasInfo) }}
        <blockquote class="layui-elem-quote xm-quote red">
            请买家使用“驽马验号”APP进行截图
        </blockquote>
        @{{ else }}
            <table class="layui-table">
                <thead>
                    <tr>
                        <th colspan="5" style="text-align: left">基本信息&nbsp;（<font color="red">更新时间：@{{ uptime }}</font>）</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td rowspan="3" style="width:100px;"><img src="@{{ info.avatar }}"></td>
                        <td style="text-align: left;">昵称：@{{ info.nickname }}</td>
                        <td style="text-align: left;">姓名：@{{ info.realname }}</td>
                        <td style="text-align: left;">性别：@{{ info.sexText }}</td>
                        <td style="text-align: left;">年龄：@{{ info.age }}</td>
                    </tr>
                    <tr>
                        <td style="text-align: left;">信用：<img src="@{{ info.creditImg }}" /></td>
                        <td style="text-align: left;">认证：@{{ info.authName }}&nbsp;<img src="@{{ info.authImg }}" /></td>
                        <td style="text-align: left;">会员等级：@{{ info.level | strLevel weight.ApassService }}</td>
                        <td style="text-align: left;">信用评级：<font color="red">@{{ info.credit_level }}</font></td>
                    </tr>
                    <tr>
                        <td style="text-align: left;" colspan="4">地址：@{{ info.address }}</td>
                     </tr>
                </tbody>
            </table>
            <div class="layui-row">
                <div class="layui-col-md6">
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <th colspan="3" style="text-align: left">喜好数据</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td style="width:33.33%">关注店铺</td>
                                <td style="width:33.33%">收藏宝贝</td>
                                <td style="width:33.33%">足迹</td>
                            </tr>
                            <tr>
                                <td><font color="green">@{{ shopping.shopnum }}</font></td>
                                <td><font color="blue">@{{ shopping.goodnum }}</font></td>
                                <td><font color="red">@{{ shopping.tracenum }}</font></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="layui-col-md6">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th colspan="5" style="text-align: left">购物数据</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td style="width:20%">待付款</td>
                            <td style="width:20%">待发货</td>
                            <td style="width:20%">待收货</td>
                            <td style="width:20%">待评价</td>
                            <td style="width:20%">退款</td>
                        </tr>
                        <tr>
                            <td><font color="#006400">@{{ shopping.nopay }}</font></td>
                            <td><font color="#9acd32">@{{ shopping.nosend }}</font></td>
                            <td><font color="blue">@{{ shopping.noreceive }}</font></td>
                            <td><font color="#add8e6">@{{ shopping.nocomm }}</font></td>
                            <td><font color="red">@{{ shopping.refund }}</font></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th colspan="6" style="text-align: left">权重数据</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td style="width:15%">授权芝麻信用</td>
                        <td style="width:15%">实人认证</td>
                        <td style="width:15%">声纹密保</td>
                        <td style="width:15%">支付宝实名认证</td>
                        <td style="width:20%">支付宝账号身份验证</td>
                        <td style="width:20%">淘宝账号绑定手机</td>
                    </tr>
                    <tr>
                        <td class="@{{ weight.zhiMaCredit?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.zhiMaCredit|serviceInit }}</td>
                        <td class="@{{ weight.realPeople?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.realPeople|serviceInit }}</td>
                        <td class="@{{ weight.voicePrint?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.voicePrint|serviceInit }}</td>
                        <td class="@{{ weight.alipayRealname?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.alipayRealname|serviceInit }}</td>
                        <td class="@{{ weight.alipay?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.alipay|serviceInit }}</td>
                        <td class="@{{ weight.taobaoBinding?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.taobaoBinding|serviceInit }}</td>
                    </tr>
                    <tr>
                        <td style="width:15%">极速退款</td>
                        <td style="width:15%">品质保证险</td>
                        <td style="width:15%">极速维权</td>
                        <td style="width:15%">电话优先</td>
                        <td style="width:20%">免举证退换货</td>
                        <td style="width:20%">闪电退货</td>
                    </tr>
                    <tr>
                        <td class="@{{ weight.quickRefund?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.quickRefund|serviceInit 1 }}</td>
                        <td class="@{{ weight.qualityInsurance?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.qualityInsurance|serviceInit 1 }}</td>
                        <td class="@{{ weight.DisputeProcessPriority?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.DisputeProcessPriority|serviceInit 1 }}</td>
                        <td class="@{{ weight.TelephoneAnsweringPriority?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.TelephoneAnsweringPriority|serviceInit 1 }}</td>
                        <td class="@{{ weight.FreeProofOfExchange?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.FreeProofOfExchange|serviceInit 1 }}</td>
                        <td class="@{{ weight.QuickSalesReturn?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.QuickSalesReturn|serviceInit 1 }}</td>
                    </tr>
                    <tr>
                        <td style="width:15%">APASS服务</td>
                        <td rowspan="2">-</td>
                        <td rowspan="2">-</td>
                        <td rowspan="2">-</td>
                        <td rowspan="2">-</td>
                        <td rowspan="2">-</td>
                    </tr>
                    <tr>
                        <td class="@{{ weight.ApassService?'yhcc-green':'yhcc-orangered' }}" >@{{ weight.ApassService|serviceInit 1 }}</td>
                    </tr>
                </tbody>
            </table>
            <div class="layui-row">
                <div class="layui-col-md6">
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <th colspan="5" style="text-align:left;">信誉明细</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td colspan="2" style="text-align:left;">买家累计信用：@{{ rate.credit }}&nbsp;&nbsp;<img src="@{{ rate.creditImg }}" /></td>
                                <td colspan="3" style="text-align:right;">好评率：@{{ rate.summary }}</td>
                            </tr>
                            <tr>
                                <th style="width:20%"></th>
                                <th style="width:20%">最近1周</th>
                                <th style="width:20%">最近1个月</th>
                                <th style="width:20%">最近6个月</th>
                                <th style="width:20%">6个月之前</th>
                            </tr>
                            <tr>
                                <td>好评</td>
                                <td>@{{ rate.good.week }}</td>
                                <td>@{{ rate.good.month }}</td>
                                <td>@{{ rate.good.month6 }}</td>
                                <td>@{{ rate.good.more }}</td>
                            </tr>
                            <tr>
                                <td>中评</td>
                                <td><font color="orange">@{{ rate.neutral.week }}</font></td>
                                <td><font color="orange">@{{ rate.neutral.month }}</font></td>
                                <td><font color="orange">@{{ rate.neutral.month6 }}</font></td>
                                <td><font color="orange">@{{ rate.neutral.more }}</font></td>
                            </tr>
                            <tr>
                                <td>差评</td>
                                <td><font color="red">@{{ rate.bad.week }}</font></td>
                                <td><font color="red">@{{ rate.bad.month }}</font></td>
                                <td><font color="red">@{{ rate.bad.month6 }}</font></td>
                                <td><font color="red">@{{ rate.bad.more }}</font></td>
                            </tr>
                            <tr>
                                <td colspan="5" style="text-align: left;"><a href="javascript:void(0)" data-url="{{ url('account/rate') }}" data-no="@{{ account_no }}"  class="viewrate">查看给他人评价(最近10条)</a></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="layui-col-md6">
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <th colspan="4" style="text-align: left">淘气值 (<font color="red">@{{ tqzhi.num }}</font>)</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td rowspan="2">购物分</td>
                                <td rowspan="2">@{{ tqzhi.shopping.num }}</td>
                                <td>上期&nbsp;@{{ tqzhi.shopping.last_p }}</td>
                                <td>@{{ tqzhi.shopping.last_m }}</td>
                            </tr>
                            <tr>
                                <td>本期&nbsp;@{{ tqzhi.shopping.current_p }}</td>
                                <td>@{{ tqzhi.shopping.current_m }}</td>
                            </tr>
                            <tr>
                                <td rowspan="3">奖励分</td>
                                <td rowspan="3">@{{ tqzhi.award.num }}</td>
                                <td>购物奖励分</td>
                                <td>@{{ tqzhi.award.shopping }}</td>
                            </tr>
                            <tr>
                                <td>互动奖励分</td>
                                <td>@{{ tqzhi.award.interactive }}</td>
                            </tr>
                            <tr>
                                <td>亲情奖励分</td>
                                <td>@{{ tqzhi.award.qinqing }}</td>
                            </tr>
                            <tr>
                                <td>基础分</td>
                                <td>@{{ tqzhi.basic.num }}</td>
                                <td colspan="2" style="border-left:none;"></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th style="text-align: left;">信用评级指标</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td style="padding:1px 0;">
                            <div id="alistar_intro_wrapper" style="background: #4A4946;">
                                 <div class="shopping-behaviour-rating">
                                     <div class="star">
                                         <i class="full-star"></i>
                                         <i class="full-star"></i>
                                         <i class="full-star"></i>
                                         <i class="full-star"></i>
                                         <i class="none-star"></i>
                                     </div>
                                     <p class="text"><span class="desc">优秀</span></p>
                                     <p class="desc">信誉评级是根据以下五个维度综合评估而来</p>
                                 </div>
                                <div class="polygon">
                                    <div class="ACCOUNT_INFO item" data-index="0">
                                        <span class="alistar-font"></span>
                                        <span class="text">账户信息</span>
                                    </div>
                                    <div class="BUY_RECORD item" data-index="1">
                                        <span class="alistar-font"></span>
                                        <span class="text">购物历史</span>
                                    </div>
                                    <div class="BUY_CREDIT item" data-index="2">
                                        <span class="alistar-font"></span>
                                        <span class="text">购物信用</span>
                                    </div>
                                    <div class="BUY_COMPLIANCE item" data-index="3">
                                        <span class="alistar-font"></span>
                                        <span class="text">购物合规</span>
                                    </div>
                                    <div class="BUY_FEED item" data-index="4">
                                        <span class="alistar-font"></span>
                                        <span class="text">评价历史</span>
                                    </div>
                                    <img src="{{ asset('images/alistar_bg.png') }}" alt="" class="bg" ks_mark="y">
                                    <svg class="pentagon">
                                        <polygon points="@{{ weight.points }}"></polygon>
                                    </svg>
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        @{{ /if }}
    </script>
@endsection
@section('script')
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.config.js') }}"></script>
    <script type="text/javascript" src="{{ asset('js/template-web.js') }}"></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.all.js') }}"></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/lang/zh-cn/zh-cn.js') }}"></script>
    <script type="text/javascript">
        layui.use(['form', 'laydate', 'element', 'layer', 'utils', 'formField', 'table'], function () {
            var form = layui.form;
            var element = layui.element;
            var URL = layui.utils.URL;
            var $ = layui.$;
            var layer = layui.layer;

            template.defaults.imports.moneyFmt=function (value) {
                value = parseFloat(value).toFixed(2)
                return value;
            };
            template.defaults.imports.strLevel=function (value,apass) {
                value = value==1?'普通会员':(value==2 && apass==0?'超级会员':'Apass会员');
                return value;
            };
            template.defaults.imports.serviceInit=function (value,flag) {
                value = value==1?(flag==1?'已享受':'已完成'):(flag==1?'未享受':'未完成');
                return value;
            };
            form.on('submit(btn_query)', function (data) {
                var _url = $(data.form).prop('action');
                var _account_no = $("#account_no").val();
                if (_account_no == '') {
                    layer.msg('请填写买家账号', {icon: 5, time: 1000});
                    return false;
                }
                var _loadlay_id = null;
                URL.post(_url, {account_no:_account_no}, {
                    dataType: 'json',
                    beforeSend:function(){
                        _loadlay_id = layer.load();
                    },
                    success: function (res) {
                        if (res.code == 1) {
                            var _content = res.data.content;
                            var _cutimage = res.data.images;
                            var _hasInfo = 0;
                            if(_cutimage.length>0){
                                _hasInfo= 1;
                            }
                            var _info = res.data.info;
                            _info['account_no'] = _account_no;
                            var _html = template('content',_content);
                            $(".layui-tab-content .layui-tab-item").eq(0).html(_html);
                            _html = template('account_info',_info);
                            $("#basic_info").html(_html);
                            if(_hasInfo){
                                $("#no_data_found").removeClass('layui-show').addClass('layui-hide');
                            }else{
                                $("#no_data_found").removeClass('layui-hide').addClass('layui-show');
                            }
                            _html = template('cutimage',{images:_cutimage,hasInfo:_hasInfo});
                            $("#cutimage_content").html(_html);
                        } else {
                           layer.msg(res.message, {icon: 5, times: 2000});
                        }
                    },
                    complete:function(){
                        layer.close(_loadlay_id);
                    }
                })
                return false;
            })
            $("#image_tab").on('click','img',function(){
                var _img = $(this).prop('src');
                parent.layer.open({
                    title:false,
                    type:1,
                    content:'<img src="'+_img+' " width="500px"/>'
                })
            })
            $("#info_tab").on('click','.viewrate',function(){
                var _url = $(this).data('url');
                var _account_no = $(this).data('no');
                _url = _url +'?account_no='+_account_no;
                parent.layer.open({
                    title:'查看评价记录',
                    type:2,
                    content:_url,
                    area:['900px','500px'],
                    maxmin:true
                })
            });
        });
    </script>
@endsection